module.exports = (app) => {
  const { STRING, INTEGER, DATE } = app.Sequelize;

  const Classification = app.model.define('Classification', {
    id: { type: INTEGER, primaryKey: true, autoIncrement: true },
    uuid: { type: STRING(36), unique: true },
    name: { type: STRING(255) },
    createdAt: { type: DATE, field: 'created_at' },
    updatedAt: { type: DATE, field: 'updated_at' },
  }, {
    tableName: 'classifications'
  });

  Classification.associate = () => {
    app.model.Classification.hasMany(app.model.Conclusion, {
      foreignKey: 'fk_classification',
      sourceKey: 'id',
    });
  };

  return Classification;
};
